package com.xm.servlet.background.commodity;

import com.xm.service.background.CommodityDetailsService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author 康文程
 * @date 2024-1-19 上午 09:45
 */
@WebServlet("/background/update/commodity/details/image")
public class UpdateCommodityDetailsImageServlet extends HttpServlet {
    private final CommodityDetailsService service = new CommodityDetailsService();

    @SneakyThrows
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp){
        resp.setContentType("text/html;charset=utf-8");
        String commodityId = req.getParameter("commodityId");
        String detailsImages = req.getParameter("detailsImages");
        resp.getWriter().print(service.updateDetailsImagesByCommodityId(Integer.parseInt(commodityId),detailsImages));
    }
}
